
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].[gspAccessRole_SEARCH]
(
@roleId int = null,
@name nvarchar(50) = null,
@description nvarchar(250) = null,
@isDeleted bit = null,
@createDate datetime = null,
@lastModifiedDate datetime = null
)
AS

SELECT
  *
FROM
  [dbo].[AccessRole]
WHERE
  (@roleId IS NULL OR [RoleId] = @roleId)
AND
  (@name IS NULL OR @name = '' OR [Name] = @name)
AND
  (@description IS NULL OR @description = '' OR [Description] LIKE @description + '%')
AND
  (@isDeleted IS NULL OR [IsDeleted] = @isDeleted)
AND
  (@createDate IS NULL OR [CreateDate] = @createDate)
AND
  (@lastModifiedDate IS NULL OR [LastModifiedDate] = @lastModifiedDate)

GO
